package com.mes.defece.controller;

import com.mes.common.pojo.MESResult;
import com.mes.defece.service.ShipmentService;
import com.mes.pojo.defece.ProcessPojo;
import com.mes.pojo.defece.Shipment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 侯伟豪
 * @Company 起点编程
 * @Description
 * @Time 2024/10/24 19:46
 */
@RestController
@CrossOrigin
@RequestMapping("/shipment")
public class ShipmentController {
    @Autowired
    private ShipmentService shipmentService;
//    分页查询
    @GetMapping("/selectAll")
    public MESResult selectAll(Shipment shipment, @RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer limit)
    {
        return shipmentService.selectAll(shipment,page,limit);
    }
//    新增数据信息
    @PostMapping("/add")
    public MESResult addShipment( @RequestBody Shipment shipment)
    {
        return shipmentService.addShipment(shipment);
    }
//    根据id查询数据信息
    @GetMapping("/selectById")
    public MESResult selectById(Long shipmentId)
    {
        return shipmentService.selectById(shipmentId);
    }
//    根据id修改数据信息
    @PutMapping("/update")
    public MESResult updateById( @RequestBody Shipment shipment)
    {
        return shipmentService.updateShipmentById(shipment);
    }
//    删除数据
    @DeleteMapping("/delete")
    public MESResult deleteById(Long shipmentId)
    {
        return shipmentService.deleteById(shipmentId);
    }
}